package com.uxwine.view.t;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.uxwine.alarm.R;

public class ClockButton extends LinearLayout
{
	private LinearLayout mlayout;
	private int mnType;
	public ClockButton(Context context, AttributeSet attrs)
	{
		super(context, attrs);
		this.setClickable(true);
		TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.ClockButton);
		mnType = arr.getInt(R.styleable.ClockButton_type, 0);
		arr.recycle();

		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.view_clock_btn, this);
		mlayout = (LinearLayout)findViewById(R.id.layout);
		this.setTag(mlayout.getId());
		ImageView img = (ImageView) findViewById(R.id.img);
		if (mnType == 1)
		{
			img.setImageResource(R.drawable.clock_btn_des_orange1);
		}
		if (mnType == 2)
		{
			img.setImageResource(R.drawable.clock_btn_des_orange2);
		}
		if (mnType == 3)
		{
			img.setImageResource(R.drawable.clock_btn_des_orange3);
		}
	}

	public void setOnClickListener (OnClickListener listener) {		
		mlayout.setOnClickListener(listener);
		
	}

}
